/**
 * @brief 超时连接测试1:创建一个客户端,给服务器发送一次数据之后,不动了,查看服务器是否会正常的超时关闭连接
*/

#include "../source/server.hpp"

int main()
{
    // 创建客户端连接
    Socket clientsock;
    clientsock.CreateClient(8080, "127.0.0.1");
    std::string req = "GET /hello HTTP/1.1\r\nConnection: keep-alive\r\nContent-Length: 0\r\n\r\n";
    for (;;)
    {
        int ret = clientsock.Send(req.c_str(), req.size());
        assert(ret > 0);
        char buffer[1024] = {0};
        ret = clientsock.Recv(buffer, 1023);
        LogMessage(DEBUG, "[%s]", buffer);
        sleep(15);
    }

    clientsock.Close();
    return 0;
}